package com.ehotting.edsta.diagnosisPredict.feign.factory;

import com.ehotting.eaf.core.web.domain.diagnosisPredict.PageDto;
import com.ehotting.eaf.core.web.domain.diagnosisPredict.Response;
import com.ehotting.edsta.diagnosisPredict.domain.dto.MaterialInfoDto;
import com.ehotting.edsta.diagnosisPredict.domain.dto.MaterialInfoSearchDto;
import com.ehotting.edsta.diagnosisPredict.feign.MaterialFeignService;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 素材集的降级处理
 *
 * @author edsta
 */
@Slf4j
@Component
public class MaterialFallbackFactory implements FallbackFactory<MaterialFeignService> {

    @Override
    public MaterialFeignService create(Throwable throwable) {
        log.error("素材集调用失败:{}", throwable.getMessage());
        return new MaterialFeignService() {
            @Override
            public Response<PageDto<MaterialInfoDto>> materialInfoSearch(MaterialInfoSearchDto dto) {
                return null;
            }

            @Override
            public Response<MaterialInfoDto> saveAndUpload(MultipartFile file, String fileDesc, String fileName, String projectId) {
                return null;
            }

            @Override
            public Response<MaterialInfoDto> materialInfoSave(MaterialInfoDto dto) {
                return null;
            }

            @Override
            public Response<List<String[]>> viewfile(String encoding, Long fileId) {
                return null;
            }

            @Override
            public Response<Boolean> batch(String ids) {
                return null;
            }

            @Override
            public feign.Response downloadfile(Long fileId) {
                return null;
            }

            @Override
            public Response<MaterialInfoDto> saveNoProject(MaterialInfoDto dto) {
                return null;
            }

            @Override
            public Response<MaterialInfoDto> uploadNoProject(MultipartFile file, Long id) {
                return null;
            }

            @Override
            public feign.Response getUrl(String projectType) {
                return null;
            }
        };
    }
}
